import { IncomingHttpHeaders } from 'http';

import operate from '@dfeidao/atom-nodejs/db/operate';
import { systemid } from '../../atom/config';
interface Message {
	filter: {
		productid: string,
		fzno: number,
		answer: string,
		right_answer: string,
		option_a: string,
		option_b: string,
		option_c: string,
		option_d: string,
		paper_number: string,
		question_no: string,
		question_number: string,
		score: number,
		topic: string,
		topic_type: string,
		is_right: boolean
	};
	// cookie: {
	// 	uk: string;
	// 	[key: string]: string
	// };
	// urls: {
	// 	base: string;
	// 	origin: string;
	// 	url: string;
	// };
	// query: {};
	// params: {};
	// headers: {};
	// captcha: string;
}

export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {
	const { exec, insert } = operate(action_id, session_id, systemid);
	// 插入数据
	insert('exam_question', message.filter);
	const res = await exec();
	return res;
}
